package com.steam.util;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
public class ConnectionUtil {
    public static Connection getConnection() throws Exception {
        //定义连接工厂
        ConnectionFactory factory = new ConnectionFactory();
        //设置服务地址
//        factory.setHost("121.42.137.13");
        factory.setHost("10.25.108.172");
        //端口
        factory.setPort(5672);
//        factory.setPort(5670);
        //设置账号信息，用户名、密码、vhost
        factory.setVirtualHost("/jinan");
        factory.setUsername("admin");
        factory.setPassword("adminjinan");
        // 通过工程获取连接
        Connection connection = factory.newConnection();
        return connection;
    }
}
